#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

/**
 * Definition for a binary tree node.
 */
struct TreeNode {
	int val;
	struct TreeNode* left;
	struct TreeNode* right;
};
typedef struct TreeNode treeNode, *treenode;

int findTilt(struct TreeNode* root);
int dfs(treenode root);

int main()
{
	return 0;
}

int res;
int findTilt(struct TreeNode* root)
{
	res = 0;
	dfs(root);
	return res;
}

int dfs(treenode root)
{
	if (!root) return 0;
	int sumL = dfs(root->left),
		sumR = dfs(root->right);
	res += abs(sumL - sumR);
	return sumL + sumR + root->val;
}
